﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AnnotateMe.Interfaces;
using System.Drawing;

namespace AnnotateMe.Logic
{
    public class RandomColorProvider : IColorProvider
    {
        private readonly Random random;

        public RandomColorProvider()
        {
            // seed the generator with 2 because
            // this gives a good sequence of colors
            const int RandomSeed = 2;
            this.random = new Random(RandomSeed);
        }

        public Color GetNextColor()
        {
            // to create lighter colors:
            // take a random integer between 0 & 128 (rather than between 0 and 255)
            // and then add 127 to make the color lighter
            var red = (byte)(random.Next(128) + 127);
            var green = (byte)(random.Next(128) + 127);
            var blue = (byte)(random.Next(128) + 127);

            Color color = Color.FromArgb(255, red, green, blue);

            return color;
        }
    }
}
